﻿@model AddSpotCommentModel
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Web.Models.WindAlert;

@{
    Html.AppendScriptParts("~/Windalert/Scripts/jquery.autosize.js");
    Html.AppendScriptParts("~/Windalert/Scripts/jquery.limit-1.2.source.js");
}

<script type="text/javascript">

    $(function () {

        $('textarea.comment-textarea').autosize({ append: "\n" });
        $('textarea.comment-textarea').limit(100, '#charsLeft');
    });

</script>
@using (Html.BeginForm("Spot", "WSpot", FormMethod.Post, new { enctype = "multipart/form-data", name = "frm", id = "frm" }))
{
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">@T("Windalert.Spot.Comments")</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group row">
                        <div class="col-md-6">
                            @Html.DropDownList("SpotId", Model.AvailableSpots, new { @class = "form-control" })
                        </div>
                        <div class="col-md-6">
                            @Html.ValidationMessageFor(model => model.SpotId)
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-md-6">
                            @T("WindAlert.Spot.Comments.CharsLeft"): <span id="charsLeft"></span>
                            <br />
                            @Html.TextAreaFor(model => model.CommentText, new { Name = "CommentText", id = "CommentText", @class = "comment-textarea enquiry form-control", placeholder = T("WindAlert.Spot.Comments.AddYourComment").Text })
                        </div>
                        <div class="col-md-6">
                            @Html.ValidationMessageFor(model => model.CommentText)
                        </div>
                    </div>
                    <div class="form-group row">
                        <div class="col-md-6">
                            <input type="file" id="uploadedFile" name="uploadedFile" />
                        </div>
                        <div class="col-md-6">
                            (@String.Format(T("Windalert.Spot.Comments.MaximumUploadedFileSize").Text, Model.PictureMaximumSizeBytes / 1048576))
                        </div>
                   </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">@T("Common.Close")</button>
                    <input name="add-comment" class="btn btn-primary" type="submit" value="@T("WindAlert.Spot.Comments.SubmitButton")" />
                </div>
            </div>
        </div>
    </div>
}
